
class Person {
    private int age;

    public void setAge(int newAge) {
        if (newAge >= 0) {
            age = newAge;
            System.out.println("年龄合法，当前的年龄" + age);
        } else {
            System.out.println("年龄不合法，不能为负数");
        }
    }
}

